1 /******************************************************************************
4 * HVM instruction emulation. Used for MMIO and VMX real mode.
6 * Copyright (c) 2008 Citrix Systems, Inc.
9 * Keir Fraser <keir@xen.org>
12 #ifndef __ASM_X86_HVM_EMULATE_H__
13 #define __ASM_X86_HVM_EMULATE_H__
15 #include <xen/config.h>
17 #include <asm/hvm/hvm.h>
18 #include <asm/x86_emulate.h>
20 struct hvm_emulate_ctxt {
21 struct x86_emulate_ctxt ctxt;
23 /* Cache of 16 bytes of instruction. */
25 unsigned long insn_buf_eip;
26 unsigned int insn_buf_bytes;
28 struct segment_register seg_reg[10];
29 unsigned long seg_reg_accessed;
30 unsigned long seg_reg_dirty;
43 EMUL_KIND_SET_CONTEXT_DATA,
44 EMUL_KIND_SET_CONTEXT_INSN
48 struct hvm_emulate_ctxt *hvmemul_ctxt);
49 int hvm_emulate_one_no_write(
50 struct hvm_emulate_ctxt *hvmemul_ctxt);
51 void hvm_emulate_one_vm_event(enum emul_kind kind,
53 unsigned int errcode);
54 void hvm_emulate_prepare(
55 struct hvm_emulate_ctxt *hvmemul_ctxt,
56 struct cpu_user_regs *regs);
57 void hvm_emulate_init(
58 struct hvm_emulate_ctxt *hvmemul_ctxt,
59 const unsigned char *insn_buf,
60 unsigned int insn_bytes);
61 void hvm_emulate_writeback(
62 struct hvm_emulate_ctxt *hvmemul_ctxt);
63 struct segment_register *hvmemul_get_seg_reg(
65 struct hvm_emulate_ctxt *hvmemul_ctxt);
66 int hvm_emulate_one_mmio(unsigned long mfn, unsigned long gla);
68 int hvmemul_insn_fetch(enum x86_segment seg,
72 struct x86_emulate_ctxt *ctxt);
73 int hvmemul_do_pio_buffer(uint16_t port,
78 void hvm_dump_emulation_state(const char *prefix,
79 struct hvm_emulate_ctxt *hvmemul_ctxt);
81 #endif /* __ASM_X86_HVM_EMULATE_H__ */
89 * indent-tabs-mode: nil